package com.ht.base.system.client;

import com.ht.base.system.common.pojo.bo.SysDeptBO;
import com.ht.base.system.common.pojo.qto.SysDeptQTO;
import com.ht.base.system.common.pojo.vo.TreeSelect;
import org.base.common.appexception.AppException;
import org.base.common.appexception.ResultData;
import org.base.common.page.PageBO;

import java.util.List;

/**
 * @Author hdengxian
 * @Date 2023/8/15 17:07
 */
public interface SysDeptClient {
    /**
     * 新增部门接口
     * @param dept
     * @return
     * @throws AppException
     */
    ResultData<Boolean> saveDept(SysDeptBO dept) throws AppException;

    /**
     * 修改部门接口
     * @param dept
     * @return
     * @throws AppException
     */
    ResultData<Boolean> updateDept(SysDeptBO dept) throws AppException;

    /**
     * 删除部门接口
     * @param sysDeptId
     * @return
     * @throws AppException
     */
    ResultData<Boolean> delDept(Long sysDeptId) throws AppException;

    /**
     * 通过部门ID查询部门
     * @param sysDeptId
     * @return
     * @throws AppException
     */
    ResultData<SysDeptBO> findDeptById(Long sysDeptId) throws AppException;

    /**
     * 分页查询部门列表
     * @param qto
     * @return
     * @throws AppException
     */
    ResultData<PageBO<SysDeptBO>> findDeptForPage(SysDeptQTO qto) throws AppException;

    /**
     * 查询组织列表
     *
     * @param qto
     * @return
     * @throws AppException
     */
    ResultData<List<SysDeptBO>> findSysDeptList(SysDeptQTO qto) throws AppException;

    /**
     * 构建组织树
     * 参数是非树结构
     *
     * @param deptList
     * @return
     * @throws AppException
     */
    ResultData<List<SysDeptBO>> buildDeptTree(List<SysDeptBO> deptList) throws AppException;

    /**
     * 构建前端树
     * 传入的是树结构的部门集合
     *
     * @param deptTree
     * @return
     * @throws AppException
     */
    ResultData<List<TreeSelect>> buildTreeSelect(List<SysDeptBO> deptTree) throws AppException;
}
